
* Change directory here to where you have your data:
global rep_data "C:\Users\andrkot\Dropbox (Frischsenteret)\GBV_application\dofiles\replication_polpart"

global results = "C:\Users\andrkot\Dropbox (Frischsenteret)\GBV_application\dofiles\replication_polpart\results"

/*
Install the following commands if you do not have them:

cap ssc install cibar
cap ssc install pdslasso
cap ssc install lassopack
cap net install grc1leg2
*/

****************** Table 1 *******************************
* Data for all waves:
use "$rep_data/aw.dta", clear 


local varlist /// 
meeting_last_year_r raise_last_year_r interested_r attend_meet_Kebele_r ///
soc_rel_r leisure_r any_wage_job_last6_r_alt ea_f_last6_r  ///
orig_treatment_r base_K1_r base_age_r ///
base_Muslim_r base_Protestant_r   base_Medium_edu_r base_High_edu_r 

cd "$results"
estpost summarize `varlist' if block!=.
est save "desk_all", replace
eststo all

estpost summarize `varlist' if wave==1 & id_r!=. & orig_treatment_r!=. & block!=.
est save "desk_all_1", replace
eststo all_1

estpost summarize `varlist' if wave==2 & id_r!=. & orig_treatment_r!=. & block!=.
est save "desk_all_2", replace
eststo all_2

estpost summarize `varlist' if wave==5 & id_r!=. & orig_treatment_r!=.  & block!=.
est save "desk_all_5", replace
eststo all_5

local varlist /// 
meeting_last_year_r attend_meet_Kebele_r  interested_r raise_last_year_r ///
soc_rel_r leisure_r any_wage_job_last6_r_alt ea_f_last6_r  ///
orig_treatment_r base_K1_r base_age_r ///
base_Muslim_r base_Protestant_r base_Medium_edu_r base_High_edu_r 


cd "$results"
#delimit;
esttab all_1 all_2 all_5 using "Table_1.tex",
    style(tex) /*stats(N)*/  
    cells("mean (fmt(2 2 2 2 2 2 2 0 2 2 2 2) pattern(1 1 1 1 1 1)) sd (fmt(2 2 2 2 2 2 2 0 2 2 2 2) par pattern(1 1 1 1 1 1)) ") 
	mgroups(
		"Baseline" "Wave 2" "Wave 5"
		, pattern(1 1 1) 
		prefix(\multicolumn{@span}{c}{) 
		suffix(}) 
		span 
		erepeat(\cmidrule(lr){@span})
	)
	order(`varlist')
    collabels(\multicolumn{1}{c}{Mean} \multicolumn{1}{c}{SD})
	varlabels(
	raise_last_year_r "Raised issue last year"
	attend_meet_Kebele_r "Kebele meetings"
	meeting_last_year_r "Community meeting last year"
	interested_r "Interested in politics"
	leisure_r "Leisure time last 7 days (hours)"
	soc_rel_r "Social and religious activities last 7 days (hours)"	
	any_wage_job_last6_r_alt "Any wage job ever/last 6 months*" 
	ea_f_last6_r "Earnings from wage job last 6 months (in Birr)" 
	orig_treatment_r "Treatment"	
	base_K1_r "Any formal wage job (ever)"
	base_age_r "Age"
	base_Muslim_r "Muslim"
	base_Protestant_r "Protestant"
	base_Medium_edu_r "Medium education"
	base_High_edu_r "High education"
	,blist(meeting_last_year_r "\multicolumn{2}{l}{\emph{Political outcome variables}} \\" 
				soc_rel_r "\multicolumn{2}{l}{\emph{Other outcome variables}} \\" 
				any_wage_job_last6_r_alt "\multicolumn{2}{l}{\emph{Employment and income variables}} \\"
				orig_treatment_r "\multicolumn{2}{l}{\emph{Main baseline variables (constant over 	time)}} \\"
	)
	)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
    replace;
#delimit cr





****************** Table 2 *******************************
* Data for wave 5:
use "$rep_data/w5.dta", clear 

local varlist /// 
would_vote   protest_last_year express_last_year internal_eff external_eff ///
discuss_politics_narrow discuss_politics_broad  pressured_now pressured_before lose_influence_now lose_influence_before month_factory_job any_factory_job ///
 
cd "$results"
estpost summarize `varlist' if orig_treatment!=.
est save "desk_new5", replace
eststo new5

local varlist /// 
would_vote  protest_last_year express_last_year internal_eff external_eff ///
discuss_politics_narrow discuss_politics_broad  pressured_now pressured_before lose_influence_now lose_influence_before month_factory_job any_factory_job ///

cd "$results"
#delimit;
esttab new5 using "Table_2.tex",
    style(tex) /*stats(N)*/  
    cells("mean (fmt(2 2 2 2 2 2 2 2 2 2 2 2) pattern(1 1 1 1 1 1)) sd (fmt(2 2 2 2 2 2 2 2 2 2 2 2) par pattern(1 1 1 1 1 1)) ") 
	order(`varlist')
    collabels(\multicolumn{1}{c}{Mean} \multicolumn{1}{c}{SD})
	varlabels(
	would_vote "Intend to vote"
	protest_last_year "Protested last year"
	express_last_year "Express last year"
	internal_eff "Internal efficacy"
	external_eff "External efficacy"	
	discuss_politics_narrow "Discuss narrow politics"
	discuss_politics_broad "Discuss broad politics"	
	pressured_now "Feel pressured to attend meetings"
	pressured_before "Felt pressured before Abiy"
	lose_influence_now "Lose influence if not attending meetings"
	lose_influence_before "Lost influence before Abiy"
	month_factory_job "Months with factory job" 
	any_factory_job "Any month with factory job" 
	,blist(would_vote "\multicolumn{2}{l}{\emph{Newly collected outcomes}} \\" 
				month_factory_job "\multicolumn{2}{l}{\emph{New employment variables}} \\" 
	)
	)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
    replace;
#delimit cr

****************** Table 3 *******************************
* Multipanel
* Panel A 
* * Data for wave 2:
use "$rep_data/w2.dta", clear 

set more off
foreach var of varlist formal_last6  ea_f_last6  ///
///
{
* First stage
reg `var' orig_treatment i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_fs_a
}


local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab formal_last6_fs_a  ea_f_last6_fs_a 
		using "Table_3a.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Any wage job" "Earnings from wage job")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{10}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
	
	

* Panel B:
* Wave 5
use "$rep_data/w5.dta", clear 

set more off
foreach var of varlist month_factory_job any_factory_job   any_wage_job_last6  ea_f_last6 ea_f_sh_last6 ea_last6 ea_sh_last6    ///
///
{
* First stage
reg `var' orig_treatment i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_fs_a

}

local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab any_wage_job_last6_fs_a  ea_f_last6_fs_a month_factory_job_fs_a any_factory_job_fs_a 
		using "Table_3b.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Any wage job" "Earnings from wage job" "Months with factory job" "Any month with factory job" )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{10}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
	
****************** Figure 1 *******************************
* Data for all waves:
use "$rep_data/aw.dta", clear 

cibar  any_wage_job_last6_r_alt  , over1(orig_treatment) over2(wave)  graphopts(ytitle("Any formal wage job last 6 months")yscale(range(0 .)) ylabel(0 0.5 0.8))  bargap(5) 
graph export "$results\Figure_1.pdf", replace	


****************** Table 4 *******************************

* 3 part panel:
* Panel A:
* Wave 2
use "$rep_data/w2.dta", clear 

set more off
foreach var of varlist meeting_last_year attend_meet_Kebele interested raise_last_year  ///
///
{
reg  `var' orig_treatment  i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
reg  `var' orig_treatment base_K1 base_age  ///
 base_m_`var'_m base_m_`var' base_Muslim base_Protestant base_Medium_edu base_High_edu  i.block, cl(N_Id) 
 estadd local Controls "Controls"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_b
}

local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab meeting_last_year_itt_a meeting_last_year_itt_b attend_meet_Kebele_itt_a attend_meet_Kebele_itt_b interested_itt_a interested_itt_b 
	raise_last_year_itt_a raise_last_year_itt_b 
		using "Table_4a.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("\shortstack{Community\\meeting}" "\shortstack{Community\\meeting}"  "\shortstack{Kebele\\meeting}" "\shortstack{Kebele\\meeting}" "Interested" "Interested" "\shortstack{Raised\\issue}" "\shortstack{Raised\\issue}" )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	


* Panel B
* Wave 5
use "$rep_data/w5.dta", clear 

set more off
foreach var of varlist meeting_last_year attend_meet_Kebele interested raise_last_year  ///
///
{
reg  `var' orig_treatment  i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
reg  `var' orig_treatment base_K1 base_age  ///
 base_m_`var'_m base_m_`var' base_Muslim base_Protestant base_Medium_edu base_High_edu  i.block, cl(N_Id) 
 estadd local Controls "Controls"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_b
}

local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab meeting_last_year_itt_a meeting_last_year_itt_b attend_meet_Kebele_itt_a attend_meet_Kebele_itt_b interested_itt_a interested_itt_b 
	raise_last_year_itt_a raise_last_year_itt_b  
		using "Table_4b.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("\shortstack{Community\\meeting}" "\shortstack{Community\\meeting}"  "\shortstack{Kebele\\meeting}" "\shortstack{Kebele\\meeting}" "Interested" "Interested" "\shortstack{Raised\\issue}" "\shortstack{Raised\\issue}" )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr

	
* Panel C:
* Data for all waves:
use "$rep_data/aw.dta", clear 

set more off
foreach var of varlist meeting_last_year_r attend_meet_Kebele_r interested_r raise_last_year_r   ///
///
{
reg `var' orig_treatment i.block if wave!=1, cluster(N_Id) 
	 estadd local Controls "Block"
 estadd local Wave "No"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo all_`var'_a
reg `var' orig_treatment i.block i.wave if wave!=1, cluster(N_Id) 
	 estadd local Controls "Block"
 estadd local Wave "Yes"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo all_`var'_b
}

local varlist orig_treatment_r 
 
cd "$results"
#delimit;
	noisily esttab all_meeting_last_year_r_a all_meeting_last_year_r_b all_attend_meet_Kebele_r_a all_attend_meet_Kebele_r_b all_interested_r_a all_interested_r_b 
	all_raise_last_year_r_a all_raise_last_year_r_b 
		using "Table_4c.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls Wave, labels("Control mean" "N" "R-squared" "Controls" "Wave f.e.")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("\shortstack{Community\\meeting}" "\shortstack{Community\\meeting}"  "\shortstack{Kebele\\meeting}" "\shortstack{Kebele\\meeting}" "Interested" "Interested" "\shortstack{Raised\\issue}" "\shortstack{Raised\\issue}" )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment_r "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr

	
****************** Figure 2 *******************************
* Data for all waves:
use "$rep_data/aw.dta", clear 

cibar  meeting_last_year   , over1(orig_treatment) over2(wave)  graphopts(ytitle("Community meeting (1=Yes)")yscale(range(0 .)) ylabel(0 0.5 0.8))  bargap(5) 
gr save a.gph, replace

cibar  attend_meet_Kebele_r   , over1(orig_treatment) over2(wave)  graphopts(ytitle("Kebele meeting (1=Yes)")yscale(range(0 .)) ylabel(0 0.5 0.8))  bargap(5) 
gr save b.gph, replace

cibar  interested_r   , over1(orig_treatment) over2(wave)  graphopts(ytitle("Interested (1=Yes)")yscale(range(0 .)) ylabel(0 0.5 0.8))  bargap(5) 
gr save c.gph, replace 

cibar  raise_last_year_r  , over1(orig_treatment) over2(wave)  graphopts(ytitle("Raised issue (1=yes)")yscale(range(0 .)) ylabel(0 0.5 0.8))  bargap(5) 
gr save d.gph, replace
		
graph combine a.gph b.gph c.gph d.gph 
graph export "$results\Figure_2.pdf", replace	


****************** Table 5 *******************************

* 2 part Panel
* Panel A:
* Wave 2
use "$rep_data/w2.dta", clear 

	

set more off
foreach var of varlist  leisure soc_rel  ///
///
{
reg  `var' orig_treatment  i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
reg  `var' orig_treatment base_K1 base_age  ///
 base_m_`var'_m base_m_`var' base_Muslim base_Protestant base_Medium_edu base_High_edu  i.block, cl(N_Id) 
 estadd local Controls "Controls"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_b
}

local varlist orig_treatment
 
cd "$results"
#delimit;
	noisily esttab leisure_itt_a leisure_itt_b  soc_rel_itt_a soc_rel_itt_b  
	using "Table_5a.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Leisure" "Leisure" "Social and religious activities" "Social and religious activities")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
* Panel B:
* Wave 5
use "$rep_data/w5.dta", clear 

set more off
foreach var of varlist  leisure soc_rel    ///
///
{
reg  `var' orig_treatment  i.block, cl(N_Id) 
estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
reg  `var' orig_treatment base_K1 base_age  ///
base_m_`var'_m base_m_`var' base_Muslim base_Protestant base_Medium_edu base_High_edu i.block, cl(N_Id) 
estadd local Controls "Controls"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_b
}


set more off
foreach var of varlist internal_eff external_eff  ///
///
{
reg  `var' orig_treatment  i.block, cl(N_Id) 
estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
reg  `var' orig_treatment base_K1 base_age  ///
base_m_meeting_last_year_m base_m_meeting_last_year base_Muslim base_Protestant base_Medium_edu base_High_edu  i.block, cl(N_Id) 
estadd local Controls "Controls"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_b
}

local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab leisure_itt_a leisure_itt_b  soc_rel_itt_a soc_rel_itt_b   ///
		internal_eff_itt_a internal_eff_itt_b external_eff_itt_a external_eff_itt_b
using "Table_5b.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Leisure" "Leisure" "Social" "Social"  "Internal" "Internal" "External" "External")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
	
	

****************** Table 6 *******************************
* Wave 5
use "$rep_data/w5.dta", clear 


set more off
foreach var of varlist  would_vote  protest_last_year  ///
///
{
reg  `var' orig_treatment  i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
reg  `var' orig_treatment base_K1 base_age  ///
 base_m_meeting_last_year_m base_m_meeting_last_year base_Muslim base_Protestant base_Medium_edu base_High_edu  i.block, cl(N_Id) 
 estadd local Controls "Controls"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_b
}

local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab would_vote_itt_a would_vote_itt_b  protest_last_year_itt_a protest_last_year_itt_b  
		using "Table_6.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Intend to vote" "Intend to vote"  "Protest last year" "Protest last year")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr




************ Appendix ************
****************** Figure A1 *******************************

* A map, no data, made in Arcgis: 
*Parks_cropped


****************** Table A1 *******************************
* Attrition data (Wave 2, also with observations that are only in baseline)
use "$rep_data/w2a.dta", clear 

reg attrit orig_treatment i.block, cl(N_Id) 
estadd local Controls "Block"
su attrit if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo attrit_a

reg attrit  orig_treatment base_m_meeting_last_year_m base_m_interested_m  base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu i.block base_m_meeting_last_year  base_m_interested, cl(N_Id) 
estadd local Controls "Full"
su attrit if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo attrit_b

* Wave 5 for columns 3 and 4
use "$rep_data/w5.dta", clear 

reg attrit orig_treatment i.block, cl(N_Id) 
estadd local Controls "Block"
su attrit if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo attrit_a5
 
reg attrit  orig_treatment base_m_meeting_last_year_m base_m_interested_m  base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu i.block base_m_meeting_last_year  base_m_interested, cl(N_Id) 
estadd local Controls "Full"
su attrit if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo attrit_b5


local varlist orig_treatment base_m_meeting_last_year_m base_m_interested_m base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu ///

cd "$results"
#delimit;
esttab attrit_a attrit_b attrit_a5 attrit_b5 using "Table_A1.tex",
    style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Attrition" "Attrition")
		keep(`varlist') order(`varlist')
		varlabels(
	base_m_meeting_last_year_m  "Meeting last year (B)"
	base_m_interested_m "Interested in politics (B)"
	base_K1 "Any formal wage job (ever)"
	orig_treatment "Treatment"
	base_age "Age"
	base_Muslim "Muslim"
	base_Protestant "Protestant"
	base_Medium_edu "Medium education"
	base_High_edu "High education"
	)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
    replace;
#delimit cr

****************** Table A2 *******************************
* Text, no data.

****************** Table A3 *******************************
* Wave 2
use "$rep_data/w2.dta", clear 

* The table consists of 2 columnsb) (Table_A3a and Table_A3b) and we do the following fixes by hand: 
* F-test values added by hand. Table imported in Lyx to make it nicer.
* All variables in the one-on-one regressions are moved to column 1.


* Column 1:
cap gen bml=base_meeting_last_year
cap gen bk=base_attend_meet_Kebele
set more off
foreach var of varlist bml bk base_interested base_raise_last_year  base_K1  base_age  base_Muslim base_Protestant base_Medium_edu base_High_edu  ///
///
{
reg orig_treatment `var' i.block, cl(N_Id) 
eststo `var'_rc_a
}

local varlist ///
bml bk base_interested   base_raise_last_year  base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu ///
 
cd "$results"
#delimit;
	noisily esttab *_rc_a using "Table_A3a.tex", 
	style(tex) stats(N r2, labels("N" "R-squared")  fmt(0 2)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
		mtitles("T" "T" "T" "T" "T" "T" "T" "T" "T" "T" "T" "T" "T" "T" )
	keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		bml "Meeting last year (B)"
		bk "Kebele meetings (B)"
		base_interested "Interested in politics (B)"
		base_raise_last_year "Raised issue last year (B)"
		base_m_meeting_last_year_m "Meeting last year (B)"
		base_m_interested_m "Interested in politics (B)"
		base_m_attend_meet_Kebele_m "Kebele meetings (B)"
		base_m_raise_last_year_m "Raised issue last year (B)"
		base_K1 "Any formal wage job (ever)"
		base_age "Age"
		base_Muslim "Muslim"
		base_Protestant "Protestant"
		base_Medium_edu "Medium education"
		base_High_edu "High education"
		)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
* Column 2:
reg  orig_treatment base_m_meeting_last_year_m base_m_meeting_last_year base_m_interested_m base_m_interested  base_m_attend_meet_Kebele_m base_m_attend_meet_Kebele base_m_raise_last_year_m base_m_raise_last_year base_K1 base_age  base_Muslim base_Protestant base_Medium_edu base_High_edu i.block, cl(N_Id) 
eststo rc_b


* F-test: (Added by hand)
reg  orig_treatment base_m_meeting_last_year_m base_m_meeting_last_year base_m_interested_m base_m_interested  base_m_attend_meet_Kebele_m base_m_attend_meet_Kebele base_m_raise_last_year_m base_m_raise_last_year ///
base_K1 base_age  base_Muslim base_Protestant base_Medium_edu base_High_edu i.block, cl(N_Id) 
test base_K1+base_age+base_m_meeting_last_year_m+base_m_interested_m+base_Muslim+base_Protestant+base_Medium_edu+base_High_edu+base_m_attend_meet_Kebele_m+base_m_raise_last_year_m==0
/*
       F(  1,  1261) =    0.51
            Prob > F =    0.4758
*/

local varlist ///
base_m_meeting_last_year_m base_m_attend_meet_Kebele_m base_m_interested_m  base_m_raise_last_year_m base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu ///
 
cd "$results"
#delimit;
	noisily esttab rc_b using "Table_A3b.tex", 
	style(tex) stats(N r2, labels("N" "R-squared")  fmt(0 2)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
		mtitles("T" )
	keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		base_m_meeting_last_year_m "Meeting last year (B)"
		base_m_interested_m "Interested in politics (B)"
		base_m_attend_meet_Kebele_m "Kebele meetings (B)"
		base_m_raise_last_year_m "Raised issue last year (B)"
		base_K1 "Any formal wage job (ever)"
		base_age "Age"
		base_Muslim "Muslim"
		base_Protestant "Protestant"
		base_Medium_edu "Medium education"
		base_High_edu "High education"
		)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr


****************** Table A4 *******************************
* Wave 2
use "$rep_data/w2.dta", clear 

cap gen bml=base_meeting_last_year
cap gen bk=base_attend_meet_Kebele
foreach var of varlist   base_K1 base_age  bml base_interested base_Muslim base_Protestant base_Medium_edu base_High_edu  ///
///
{
reg meeting_last_year `var' i.block, cl(N_Id) 
eststo `var'_cvfu_f_a
reg interested `var' i.block, cl(N_Id) 
eststo `var'_cvfu_f_ai
}
reg  meeting_last_year base_m_meeting_last_year_m base_m_meeting_last_year base_m_interested_m base_m_interested  base_m_attend_meet_Kebele_m base_m_attend_meet_Kebele base_m_raise_last_year_m base_m_raise_last_year base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu i.block, cl(N_Id) 
eststo cv_fu_f_b


test base_K1+base_age+base_m_meeting_last_year_m+base_m_interested_m+base_Muslim+base_Protestant+base_Medium_edu+base_High_edu+base_m_attend_meet_Kebele_m+base_m_raise_last_year_m==0
/*


       F(  1,  1261) =    8.00
            Prob > F =    0.0048




*/

reg  interested base_m_meeting_last_year_m base_m_meeting_last_year base_m_interested_m base_m_interested  base_m_attend_meet_Kebele_m base_m_attend_meet_Kebele base_m_raise_last_year_m base_m_raise_last_year ///
  base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu i.block, cl(N_Id) 
eststo cv_fu_f_bi

test base_K1+base_age+base_m_meeting_last_year_m+base_m_interested_m+base_Muslim+base_Protestant+base_Medium_edu+base_High_edu+base_m_attend_meet_Kebele_m+base_m_raise_last_year_m==0
/*



       F(  1,  1259) =    7.33
            Prob > F =    0.0069





*/

reg  attend_meet_Kebele base_m_meeting_last_year_m base_m_meeting_last_year base_m_interested_m base_m_interested  base_m_attend_meet_Kebele_m base_m_attend_meet_Kebele base_m_raise_last_year_m base_m_raise_last_year ///
  base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu i.block, cl(N_Id) 
eststo cv_fu_f_bk
test base_K1+base_age+base_m_meeting_last_year_m+base_m_interested_m+base_Muslim+base_Protestant+base_Medium_edu+base_High_edu+base_m_attend_meet_Kebele_m+base_m_raise_last_year_m==0
/*

       F(  1,  1260) =   16.05
            Prob > F =    0.0001

*/

reg  raise_last_year base_m_meeting_last_year_m base_m_meeting_last_year base_m_interested_m base_m_interested  base_m_attend_meet_Kebele_m base_m_attend_meet_Kebele base_m_raise_last_year_m base_m_raise_last_year ///
 base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu i.block, cl(N_Id) 
eststo cv_fu_f_br
test base_K1+base_age+base_m_meeting_last_year_m+base_m_interested_m+base_Muslim+base_Protestant+base_Medium_edu+base_High_edu+base_m_attend_meet_Kebele_m+base_m_raise_last_year_m==0

/*


       F(  1,  1261) =   12.85
            Prob > F =    0.0004


*/

*  Add F tests to the table by hand and make it nicer in Lyx 

local varlist ///
base_m_meeting_last_year_m base_m_attend_meet_Kebele_m base_m_interested_m  base_m_raise_last_year_m base_K1 base_age base_Muslim base_Protestant base_Medium_edu base_High_edu ///

cd "$results"
#delimit;
	noisily esttab cv_fu_f_b cv_fu_f_bk cv_fu_f_bi cv_fu_f_br using "Table A_4.tex", 
	style(tex) stats(N r2, labels("N" "R-squared")  fmt(0 2)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
	mtitles("Community" "Kebele" "Interested" "Raise issue")
		keep(`varlist') order(`varlist')
		varlabels(
		base_m_meeting_last_year_m "Meeting last year (B)"
		base_m_interested_m "Interested in politics (B)"
		base_m_attend_meet_Kebele_m "Kebele meetings (B)"
		base_m_raise_last_year_m "Raised issue last year (B)"
		orig_treatment "Treatment"
		base_K1 "Any formal wage job (ever)"
		base_age "Age"
		base_Muslim "Muslim"
		base_Protestant "Protestant"
		base_Medium_edu "Medium education"
		base_High_edu "High education"
		)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr	
	
****************** Table A5 *******************************
* Text, no data.

****************** Table A6 *******************************
* Husband data
use "$rep_data/hub.dta", clear 

foreach var of varlist meeting_last_year raise_last_year	interested attend_meet_Kebele would_vote protest_last_year   internal_eff external_eff ///
///
{
gen gap_`var'=p_`var'-`var' 	
}

su meeting_last_year p_meeting_last_year gap_meeting_last_year
di 77-48
  
* Within couple gap: 
su gap*
  

preserve 
foreach var of varlist meeting_last_year	raise_last_year	interested attend_meet_Kebele would_vote protest_last_year   internal_eff external_eff ///
///
{
replace `var'=. if p_`var'==.	
}
	
local varlist /// 
meeting_last_year	raise_last_year	interested attend_meet_Kebele would_vote protest_last_year   internal_eff external_eff  ///

cd "$results"
estpost summarize `varlist' if orig_treatment!=. 
est save "desk", replace
eststo desk
restore 

preserve 
foreach var of varlist meeting_last_year	raise_last_year	interested attend_meet_Kebele would_vote protest_last_year   internal_eff external_eff ///
///
{
replace `var'=p_`var'	
}

local varlist /// 
meeting_last_year	raise_last_year	interested attend_meet_Kebele would_vote protest_last_year   internal_eff external_eff  ///
N_4A N_4B N_4C N_4D N_4E ///

cd "$results"
estpost summarize `varlist' if orig_treatment!=.
est save "desk_husb", replace
eststo desk_husb
restore 

preserve 
 foreach var of varlist meeting_last_year	raise_last_year	interested attend_meet_Kebele would_vote protest_last_year   internal_eff external_eff ///
///
{
replace `var'=gap_`var'	
}

local varlist /// 
meeting_last_year	raise_last_year	interested attend_meet_Kebele would_vote protest_last_year   internal_eff external_eff  ///

cd "$results"
estpost summarize `varlist' if orig_treatment!=.
est save "desk_gap", replace
eststo desk_gap
restore 


local varlist /// 
meeting_last_year	raise_last_year	interested attend_meet_Kebele would_vote protest_last_year   internal_eff external_eff N_4A N_4B N_4C N_4D N_4E ///


cd "$results"
#delimit;
esttab desk_husb desk desk_gap using "Table_A6.tex",
    style(tex) /*stats(N)*/  
    cells("mean (fmt(2 2 2 2 2 2 2 2 2 2 2 2) pattern(1 1 1 1 1 1)) sd (fmt(2 2 2 2 2 2 2 2 2 2 2 2) par pattern(1 1 1 1 1 1)) ") 
	mgroups(
		"Partners""Women" "Gap"
		, pattern(1 1 1) 
		prefix(\multicolumn{@span}{c}{) 
		suffix(}) 
		span 
		erepeat(\cmidrule(lr){@span})
	)
	order(`varlist')
    collabels(\multicolumn{1}{c}{Mean} \multicolumn{1}{c}{SD})
	varlabels(
	would_vote "Intend to vote"
	raise_last_year "Raised issue last year"
	attend_meet_Kebele "Kebele meetings"
	meeting_last_year "Community meeting last year"
	interested "Interested in politics"
	protest_last_year "Protested last year"
	internal_eff "Internal efficacy"
	external_eff "External efficacy"
	N_4A "Have my say in local affairs/ decision making "
	N_4B "Access to benefits such as work, credit or cheap goods" 
	N_4C "Get information about new taxes or government policies"
	N_4D "Be informed about local security issues"
	N_4E "Get information about political issues or election campaigns"
	,blist(N_4A "\multicolumn{2}{l}{\emph{Main benefit of attending meetings}} \\" 
	)
	)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
    replace;
#delimit cr



****************** Table A7 *******************************
* 2 panels:
* Panel A:
* Wave 2
use "$rep_data/w2.dta", clear 


set more off
foreach var of varlist meeting_last_year  interested leisure soc_rel   raise_last_year attend_meet_Kebele ///
///
{
reg  `var' orig_treatment base_K1 base_age  ///
base_m_`var'_m base_m_`var' base_Muslim base_Protestant base_Medium_edu base_High_edu i.block, cl(N_Id) 
tab block if e(sample)==1, gen(bl_`var')
pdslasso  `var' orig_treatment (base_K1 base_age  ///
base_m_`var'_m base_m_`var' base_Muslim base_Protestant base_Medium_edu base_High_edu bl_`var'*), partial(bl_`var'*) cl(N_Id) 
estadd local Controls "Optimal"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_pds
drop bl_`var'*
}

local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab meeting_last_year_pds attend_meet_Kebele_pds interested_pds	raise_last_year_pds 
		using "Table_A7a.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Control mean" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("\shortstack{Community\\meeting}" "\shortstack{Kebele\\meeting}" "Interested" "\shortstack{Raised\\issue}" )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
		
* Panel B: 
* Wave 5
use "$rep_data/w5.dta", clear 


set more off
foreach var of varlist meeting_last_year  interested leisure soc_rel   raise_last_year attend_meet_Kebele ///
///
{
        reg  `var' orig_treatment base_K1 base_age  ///
 base_m_`var'_m base_m_`var' base_Muslim base_Protestant base_Medium_edu base_High_edu  i.block, cl(N_Id) 
 tab block if e(sample)==1, gen(bl_`var')
 pdslasso  `var' orig_treatment (base_K1 base_age  ///
 base_m_`var'_m base_m_`var' base_Muslim base_Protestant base_Medium_edu base_High_edu  bl_`var'*), pnotpen(bl_`var'*) cl(N_Id) 
 estadd local Controls "Optimal"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_pds
drop bl_`var'*
}
	
local varlist orig_treatment  ///
 
cd "$results"
#delimit;
	noisily esttab meeting_last_year_pds attend_meet_Kebele_pds interested_pds	raise_last_year_pds 
		using "Table_A7b.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Control mean" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("\shortstack{Community\\meeting}" "\shortstack{Kebele\\meeting}" "Interested" "\shortstack{Raised\\issue}" )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr

	
****************** Table A8 *******************************
* wave 2
use "$rep_data/w2.dta", clear 

* Table A8 
set more off
foreach var of varlist hours unpaid hh_work  sleeping eating care  school travel  ///
///
{
reg  `var' orig_treatment  i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
}

local varlist orig_treatment  
 
cd "$results"
#delimit;
	noisily esttab hours_itt_a unpaid_itt_a hh_work_itt_a  sleeping_itt_a eating_itt_a care_itt_a  school_itt_a travel_itt_a
		using "Table_A8.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Paid work" "Unpaid"  "HH work" "Sleeping" "Eating" "Personal care" "School" "Travel" )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr


****************** Table A9 *******************************
* Wave 5
	use "$rep_data/w5.dta", clear 

gen dpb=discuss_politics_broad
gen dpn=discuss_politics_narrow
 

set more off
foreach var of varlist dpb dpn ///
///
{
reg  `var' orig_treatment  i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
reg  `var' orig_treatment base_K1 base_age  ///
 base_m_meeting_last_year_m base_m_meeting_last_year base_Muslim base_Protestant base_Medium_edu base_High_edu  i.block, cl(N_Id) 
 estadd local Controls "Controls"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_b
}

local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab dpb_itt_a dpb_itt_b dpn_itt_a dpn_itt_b 
		using "Table_A9.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Broad" "Broad"  "Narrow" "Narrow" )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
	discuss_politics_narrow "Discuss narrow politics"
	discuss_politics_broad "Discuss broad politics"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr

	
****************** Table A10 *******************************
* Husband data
use "$rep_data/hub.dta", clear 

	
foreach var of varlist meeting_last_year	raise_last_year	interested attend_meet_Kebele would_vote protest_last_year   internal_eff external_eff ///
///
{
reg  p_`var' orig_treatment  i.block, cl(N_Id) 
	 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
}
	
local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab meeting_last_year_itt_a  raise_last_year_itt_a  interested_itt_a attend_meet_Kebele_itt_a  would_vote_itt_a  protest_last_year_itt_a    internal_eff_itt_a  external_eff_itt_a 
		using "Table_A10.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community" "Raise issue"  "Interested"  "Kebele" "Intend to vote" "Protest"  "Internal" "External")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	

****************** Table A11 *******************************
* Wave 2
use "$rep_data/w2.dta", clear 

* number of adults:
gen nr_adults=Tot_Hh-base_B11
gen two_adults=1 if nr_adults==2
replace two_adults=0 if two_adults==. & nr_adults!=.

set more off
foreach var of varlist meeting_last_year  interested raise_last_year attend_meet_Kebele  ///
///
{
* Reduced form effects on different types of violence
reg `var' orig_treatment i.block if two_adults==1, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_two
}
	
local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab meeting_last_year_two attend_meet_Kebele_two interested_two raise_last_year_two 
	  using "Table_A11.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Mean dep. var in C group" "No. of observations" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("\shortstack{Community\\meeting}"  "\shortstack{Kebele\\meeting}" "Interested" "\shortstack{Raised\\issue}" )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr	
	


****************** Figure A2 *******************************
* Data with all waves
use "$rep_data/aw.dta", clear 

twoway (hist intdat_ 	if  wave==1, freq   color(red%30))   ///        
       (hist intdat_ 	if  wave==2, freq   color(blue%30)) ///
       (hist intdat_ 	if  wave==3, freq   color(orange%30)) ///
       (hist intdat_ 	if  wave==4, freq   color(black%30)) ///
       (hist intdat_ 	if  wave==5, freq   color(yellow%30)) ///
	     , ///   
       	xtitle(Interview date) ytitle(Number of people interviewed) ///
		legend(order(1 "Wave 1" 2 "Wave 2" 3 "Wave 3" 4 "Wave 4" 5 "Wave 5" ))	
graph export "$results\Figure_A2.pdf", replace


****************** Figure A3 & A4 *******************************
* Data with all waves
use "$rep_data/aw.dta", clear 

gen nf_job_last6_r=any_wage_job_last6_r
replace nf_job_last6_r=0 if fac_last6_r==1 
	
gen sector=1 if fac_last6_r==1
replace sector=2 if nf_job_last6_r==1
replace sector=3 if nf_job_last6_r==0 & fac_last6_r==0
label define se 1 "Factory employment" 2 "Other wage employment" 3 "No wage employment"
label values sector se

tab sector, gen(s)
label var s1 "Factory employment"
label var s2 "Other wage employment"
label var s3 "No wage employment"


gen w2=wave
label define wave_b 1 "W1" 2 "W2" 3 "W3" 4 "W4" 5 "W5" 
label values w2 wave_b

label var orig_treatment "Treatment status"

*** Figure A3
cibar  s1  if wave!=1, over1(orig_treatment) over2(w2)   graphopts(ytitle("Share in factory employment over time")yscale(range(0 .)) )  bargap(5) 
		 gr save a.gph, replace
cibar  s2  if wave!=1, over1(orig_treatment) over2(w2)   graphopts(ytitle("Share in other wage employment over time")yscale(range(0 .)) )  bargap(5) 
		 gr save b.gph, replace
cibar  s3  if wave!=1, over1(orig_treatment) over2(w2)   graphopts(ytitle("Share not in wage employment over time")yscale(range(0 .)) )  bargap(5) 
		 gr save c.gph, replace		 
grc1leg2  a.gph b.gph  c.gph , ycommon rows(1)
		graph export "$results\Figure_A3.pdf", replace	
					

*** Figure A4
cibar  ea_last6_r  if wave!=1 & sector!=3, over1(wave) over2(orig_treatment) over3(sector)  graphopts(ytitle("Earnings from any job last 6 months (in Birr)")yscale(range(0 .)) ylabel(0 4000 8000))  bargap(5) 
graph export "$results\Figure_A4.pdf", replace	



****************** Table A12 *******************************
* 2 Panels:
* Panel A:
* Wave 2:
use "$rep_data/w2.dta", clear 


set more off
foreach var of varlist  formal_last6  {
* IV Community
ivreg2 meeting_last_year (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su meeting_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_a

* IV Interested
ivreg2 interested (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su interested if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_ai

* IV Raise
ivreg2 raise_last_year (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su raise_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_ar

* Iv Kebele
ivreg2 attend_meet_Kebele (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su attend_meet_Kebele if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_ak
}


foreach var of varlist formal_last6 {
local varlist `var' 
 
cd "$results"
#delimit;
	noisily esttab   `var'_iv_a  `var'_iv_ai   `var'_iv_ar   `var'_iv_ak  using "Table_A12a.tex", 
	style(tex) stats(mean_depvar_c N r2u Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community" "Interested" "Raise"  "Kebele")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
	formal_last6 "Any wage job last 6 months" 
		)
	prehead("\begin{tabular}{l*{8}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}


* Panel B:
* Wave 5:
use "$rep_data/w5.dta", clear 


set more off
foreach var of varlist any_wage_job_last6   {
* IV Community
ivreg2 meeting_last_year (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su meeting_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_a

* IV Interested
ivreg2 interested (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su interested if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_ai

* IV Raise
ivreg2 raise_last_year (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su raise_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_ar

* IV Kebele
ivreg2 attend_meet_Kebele (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su attend_meet_Kebele if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_ak
}


foreach var of varlist any_wage_job_last6  {
local varlist `var'  
 
cd "$results"
#delimit;
	noisily esttab   `var'_iv_a  `var'_iv_ai   `var'_iv_ar   `var'_iv_ak  using "Table_A12b.tex", 
	style(tex) stats(mean_depvar_c N r2u Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community" "Interested" "Raise"  "Kebele")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
	any_wage_job_last6 "Any wage job last 6 months" 
		)
	prehead("\begin{tabular}{l*{8}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}



****************** Table A13 *******************************
* Wave 5:
use "$rep_data/w5.dta", clear 

set more off
foreach var of varlist  ea_f_last6 ea_f_sh_last6 ea_last6 ea_sh_last6    ///
///
{
ivreg2 meeting_last_year (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su meeting_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_a
}

local varlist ea_f_last6 ea_f_sh_last6 ea_last6 ea_sh_last6  
 
cd "$results"
#delimit;
	noisily esttab   ea_f_last6_iv_a ea_f_sh_last6_iv_a ea_last6_iv_a ///
	ea_sh_last6_iv_a    
	using "Table_A13.tex", 
	style(tex) stats(mean_depvar_c N r2u Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community" "Community" "Community" "Community" "Community" "Community" "Community")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
	ea_f_last6 "Earnings from wage job last 6 months" 
	ea_f_sh_last6 "Share of earnings from wage job" 
	ea_last6 "Earnings job last 6 months" 
	ea_sh_last6 "Share of earnings" 
		)
	prehead("\begin{tabular}{l*{10}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr

	
****************** Table A14 & A15 *******************************
* Wave 5:
use "$rep_data/w5.dta", clear 

set more off
foreach var of varlist month_factory_job any_factory_job   ///
///
{

* IV would_vote
ivreg2 would_vote (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su would_vote if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_av

* IV protest_last_year
ivreg2 protest_last_year (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su protest_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_ap

* IV internal_eff
ivreg2 internal_eff (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su internal_eff if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_aie

* IV external_eff
ivreg2 external_eff (`var'=orig_treatment)  i.block, cl(N_Id) 
 estadd local Controls "Block"
su external_eff if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_iv_aee

}

*** Table A14
local varlist month_factory_job   
 
cd "$results"
#delimit;
	noisily esttab   	month_factory_job_iv_av   month_factory_job_iv_ap  month_factory_job_iv_aie month_factory_job_iv_aee
  ///    
	using "Table_A14.tex", 
	style(tex) stats(mean_depvar_c N r2u Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Vote" "Protest" "Internal" "External")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
	month_factory_job "Months with factory job" 
		)
	prehead("\begin{tabular}{l*{10}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr  
	


*** Table A15
local varlist any_factory_job  
 
cd "$results"
#delimit;
	noisily esttab   	any_factory_job_iv_av   any_factory_job_iv_ap  any_factory_job_iv_aie any_factory_job_iv_aee
  ///
	using "Table_A15.tex", 
	style(tex) stats(mean_depvar_c N r2u Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Vote" "Protest" "Internal" "External")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
	any_factory_job "Any month with factory job" 
		)
	prehead("\begin{tabular}{l*{10}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr  

	
****************** Table A16 *******************************
* Wave 2
use "$rep_data/w2.dta", clear 

reg  meeting_last_year orig_treatment  i.block if region=="Amhara",  cl(N_Id) 
 estadd local Controls "Block"
su  meeting_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_meet_Amhara
reg  meeting_last_year orig_treatment  i.block if region=="Dire Dawa",  cl(N_Id) 
 estadd local Controls "Block"
su  meeting_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_meet_Dire
reg  meeting_last_year orig_treatment  i.block if region=="Oromia",  cl(N_Id) 
 estadd local Controls "Block"
su  meeting_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_meet_Oromia
reg  meeting_last_year orig_treatment  i.block if region=="SNNP",  cl(N_Id) 
 estadd local Controls "Block"
su  meeting_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_meet_SNNP
reg  meeting_last_year orig_treatment  i.block if region=="Tigray",  cl(N_Id) 
 estadd local Controls "Block"
su  meeting_last_year if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_meet_Tigray

local varlist orig_treatment 

cd "$results"
#delimit;
esttab fs_region_meet_* using "Table_A16.tex",
    style(tex) stats(mean_depvar_c N r2 Controls, labels("Mean dep. var in C group" "No. of observations" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Amhara" "Dire Dawa" "Oromia" "SNNP" "Tigray"  )
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
	)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
    replace;
#delimit cr



****************** Table A17 *******************************
* Wave 2
use "$rep_data/w2.dta", clear 

reg formal_last6 orig_treatment  i.block if region=="Amhara",  cl(N_Id) 
 estadd local Controls "Block"
su formal_last6 if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_formal_Amhara
reg formal_last6 orig_treatment  i.block if region=="Dire Dawa",  cl(N_Id) 
 estadd local Controls "Block"
su formal_last6 if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_formal_Dire
reg formal_last6 orig_treatment  i.block if region=="Oromia",  cl(N_Id) 
 estadd local Controls "Block"
su formal_last6 if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_formal_Oromia
reg formal_last6 orig_treatment  i.block if region=="SNNP",  cl(N_Id) 
 estadd local Controls "Block"
su formal_last6 if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_formal_SNNP
reg formal_last6 orig_treatment  i.block if region=="Tigray",  cl(N_Id) 
 estadd local Controls "Block"
su formal_last6 if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo fs_region_formal_Tigray


local varlist orig_treatment 

cd "$results"
#delimit;
esttab fs_region_formal_* using "Table_A17.tex",
    style(tex) stats(mean_depvar_c N r2 Controls, labels("Mean dep. var in C group" "No. of observations" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Amhara" "Dire Dawa" "Oromia" "SNNP" "Tigray")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
	)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
    replace;
#delimit cr


****************** Figure A5 *******************************
* Using only factories with at least 20 individuals for privacy reasons 
use "$rep_data/facw2.dta", clear 
label var orig_treatment "Treatment"				

reg meeting_last_year orig_treatment  i.block if fac20==3,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Dire Dawa Textile"
eststo f_3
reg meeting_last_year orig_treatment  i.block if fac20==8,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "MAA Garment & Textile"
eststo f_8

reg meeting_last_year orig_treatment  i.block if fac20==11,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Velocity Textile"
eststo f_11
reg meeting_last_year orig_treatment  i.block if fac20==12,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Indo-china Apparel"
eststo f_12
reg meeting_last_year orig_treatment  i.block if fac20==13,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Telaje Garment"
eststo f_13
reg meeting_last_year orig_treatment  i.block if fac20==14,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "PTV/Centery Garment"
eststo f_14
reg meeting_last_year orig_treatment  i.block if fac20==16,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Kidane Garment"
eststo f_16
reg meeting_last_year orig_treatment  i.block if fac20==19,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Raymond Garment"
eststo f_19
reg meeting_last_year orig_treatment  i.block if fac20==21,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "PVH Textile"
eststo f_21
reg meeting_last_year orig_treatment  i.block if fac20==24,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Almeda Textile"
eststo f_24
reg meeting_last_year orig_treatment  i.block if fac20==25,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "EPIC Apparel"
eststo f_25
reg meeting_last_year orig_treatment  i.block if fac20==27,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Arvind"
eststo f_27


set scheme s1mono
coefplot (f_3, label("Dire Dawa Textile")) (f_8, label("MAA Garment & Textile"))	(f_11, label("Velocity Textile")) (f_12, label("Indo-china Apparel")) (f_13, label("Telaje Garment")) (f_14, label("PTV/Centery Garment")) (f_16, label("Kidane Garment")) (f_19, label("Raymond Garment")) (f_21, label("PVH Textile")) (f_24, label("Almeda Textile")) (f_25, label("EPIC Apparel")) (f_27, label("Arvind")), keep(orig_treatment)    xline(0)  
graph export "$results/Figure_A5.pdf", replace


****************** Figure A6 *******************************
* Using only factories with at least 20 individuals for privacy reasons 
use "$rep_data/facw5.dta", clear 
 
label var orig_treatment "Treatment"				

reg meeting_last_year orig_treatment  i.block if fac20==3,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Dire Dawa Textile"
eststo f_3
reg meeting_last_year orig_treatment  i.block if fac20==8,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "MAA Garment & Textile"
eststo f_8

reg meeting_last_year orig_treatment  i.block if fac20==11,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Velocity Textile"
eststo f_11
reg meeting_last_year orig_treatment  i.block if fac20==12,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Indo-china Apparel"
eststo f_12
reg meeting_last_year orig_treatment  i.block if fac20==13,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Telaje Garment"
eststo f_13
reg meeting_last_year orig_treatment  i.block if fac20==14,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "PTV/Centery Garment"
eststo f_14
reg meeting_last_year orig_treatment  i.block if fac20==16,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Kidane Garment"
eststo f_16
reg meeting_last_year orig_treatment  i.block if fac20==19,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Raymond Garment"
eststo f_19
reg meeting_last_year orig_treatment  i.block if fac20==21,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "PVH Textile"
eststo f_21
reg meeting_last_year orig_treatment  i.block if fac20==24,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Almeda Textile"
eststo f_24
reg meeting_last_year orig_treatment  i.block if fac20==27,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Arvind"
eststo f_27


set scheme s1mono
coefplot (f_3, label("Dire Dawa Textile")) (f_8, label("MAA Garment & Textile"))	(f_11, label("Velocity Textile")) (f_12, label("Indo-china Apparel")) (f_13, label("Telaje Garment")) (f_14, label("PTV/Centery Garment")) (f_16, label("Kidane Garment")) (f_19, label("Raymond Garment")) (f_21, label("PVH Textile")) (f_24, label("Almeda Textile"))  (f_27, label("Arvind")), keep(orig_treatment)    xline(0)  
graph export "$results/Figure_A6.pdf", replace
				

****************** Figure A7 *******************************
* Using only factories with at least 20 individuals for privacy reasons 
* Wave 5:
use "$rep_data/facw5.dta", clear 
label var orig_treatment "Treatment"				

reg internal_eff orig_treatment  i.block if fac20==3,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Dire Dawa Textile"
eststo f_3
reg internal_eff orig_treatment  i.block if fac20==8,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "MAA Garment & Textile"
eststo f_8

reg internal_eff orig_treatment  i.block if fac20==11,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Velocity Textile"
eststo f_11
reg internal_eff orig_treatment  i.block if fac20==12,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Indo-china Apparel"
eststo f_12
reg internal_eff orig_treatment  i.block if fac20==13,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Telaje Garment"
eststo f_13
reg internal_eff orig_treatment  i.block if fac20==14,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "PTV/Centery Garment"
eststo f_14
reg internal_eff orig_treatment  i.block if fac20==16,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Kidane Garment"
eststo f_16
reg internal_eff orig_treatment  i.block if fac20==19,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Raymond Garment"
eststo f_19
reg internal_eff orig_treatment  i.block if fac20==21,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "PVH Textile"
eststo f_21
reg internal_eff orig_treatment  i.block if fac20==24,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Almeda Textile"
eststo f_24
reg internal_eff orig_treatment  i.block if fac20==27,  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Arvind"
eststo f_27


set scheme s1mono
coefplot (f_3, label("Dire Dawa Textile")) (f_8, label("MAA Garment & Textile"))	(f_11, label("Velocity Textile")) (f_12, label("Indo-china Apparel")) (f_13, label("Telaje Garment")) (f_14, label("PTV/Centery Garment")) (f_16, label("Kidane Garment")) (f_19, label("Raymond Garment")) (f_21, label("PVH Textile")) (f_24, label("Almeda Textile"))  (f_27, label("Arvind")), keep(orig_treatment)    xline(0)  
graph export "$results/Figure_A7.pdf", replace	
			

****************** Figure A8 *******************************
* Using only factories with at least 20 individuals for privacy reasons 
use "$rep_data/facw2.dta", clear 

label var orig_treatment "Treatment"				

reg meeting_last_year orig_treatment  i.block if country_fac=="China",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "China"
eststo c_1
reg meeting_last_year orig_treatment  i.block if country_fac=="Ethiopia",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Ethiopia"
eststo c_2
reg meeting_last_year orig_treatment  i.block if country_fac=="Indian",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "India"
eststo c_3
reg meeting_last_year orig_treatment  i.block if country_fac=="Indonesia",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Indonesia"
eststo c_4
reg meeting_last_year orig_treatment  i.block if country_fac=="Sri Lanka",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Sri Lanka"
eststo c_5
reg meeting_last_year orig_treatment  i.block if country_fac=="UEA",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "UEA"
eststo c_6
reg meeting_last_year orig_treatment  i.block if country_fac=="USA",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "USA"
eststo c_7


set scheme s1mono
coefplot (c_1 , label("China")) (c_2 , label("Ethiopia")) (c_3 , label("India")) (c_4 , label("Indonesia")) ///
(c_5 , label("Sri Lanka")) (c_6 , label("UAE")) (c_7 , label("USA"))  , keep(orig_treatment)    xline(0)  
graph export "$results/Figure_A8.pdf", replace


****************** Figure A9 *******************************
* Using only factories with at least 20 individuals for privacy reasons 

use "$rep_data/facw5.dta", clear 

label var orig_treatment "Treatment"				

reg meeting_last_year orig_treatment  i.block if country_fac=="China",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "China"
eststo c_1
reg meeting_last_year orig_treatment  i.block if country_fac=="Ethiopia",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Ethiopia"
eststo c_2
reg meeting_last_year orig_treatment  i.block if country_fac=="Indian",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "India"
eststo c_3
reg meeting_last_year orig_treatment  i.block if country_fac=="Indonesia",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Indonesia"
eststo c_4
reg meeting_last_year orig_treatment  i.block if country_fac=="Sri Lanka",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Sri Lanka"
eststo c_5
reg meeting_last_year orig_treatment  i.block if country_fac=="UEA",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "UEA"
eststo c_6
reg meeting_last_year orig_treatment  i.block if country_fac=="USA",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "USA"
eststo c_7


set scheme s1mono
coefplot (c_1 , label("China")) (c_2 , label("Ethiopia")) (c_3 , label("India")) (c_4 , label("Indonesia")) ///
(c_5 , label("Sri Lanka")) (c_6 , label("UAE")) (c_7 , label("USA"))  , keep(orig_treatment)    xline(0)  
graph export "$results/Figure_A9.pdf", replace	


****************** Figure A10 *******************************
* Using only factories with at least 20 individuals for privacy reasons 

* Wave 5:
use "$rep_data/facw5.dta", clear 

label var orig_treatment "Treatment"				

reg internal_eff orig_treatment  i.block if country_fac=="China",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "China"
eststo i_1
reg internal_eff orig_treatment  i.block if country_fac=="Ethiopia",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Ethiopia"
eststo i_2
reg internal_eff orig_treatment  i.block if country_fac=="Indian",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "India"
eststo i_3
reg internal_eff orig_treatment  i.block if country_fac=="Indonesia",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Indonesia"
eststo i_4
reg internal_eff orig_treatment  i.block if country_fac=="Sri Lanka",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "Sri Lanka"
eststo i_5
reg internal_eff orig_treatment  i.block if country_fac=="UEA",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "UEA"
eststo i_6
reg internal_eff orig_treatment  i.block if country_fac=="USA",  cl(N_Id) 
 estadd local Controls "Block"
 estadd local factory "USA"
eststo i_7

set scheme s1mono
coefplot (i_1 , label("China")) (i_2 , label("Ethiopia")) (i_3 , label("India")) (i_4 , label("Indonesia")) ///
(i_5 , label("Sri Lanka")) (i_6 , label("UAE")) (i_7 , label("USA"))  , keep(orig_treatment)    xline(0)  
graph export "$results/Figure_A10.pdf", replace



****************** Table A18 *******************************
 
*2 panels: 
*Panel A:
* Afrobarometer all countries.
use "$rep_data/Afro_all.dta", clear


set more off
foreach var of varlist  meeting_last_year interested raised_last_year voted protest_last_year  ///
///
{
reg  `var' formal_work if female==1, robust 
 estadd local Sample "Women"
su `var' if e(sample)==1 & formal_work==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_fem_all
}


local varlist formal_work 
 
cd "$results"
#delimit;
noisily esttab meeting_last_year_fem_all interested_fem_all raised_last_year_fem_all voted_fem_all protest_last_year_fem_all
		using "Table_A18a.tex", 
	style(tex) stats(mean_depvar_c N r2 Sample, labels("Control mean" "N" "R-squared" "Sample")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community" "Interested" "Raised" "Voted" "Protest")
		keep(`varlist') order(`varlist')
		varlabels(
	formal_work "Has paid employment" 
	female "Female" 
	)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr


*Panel B 
* Afrobarometer ethiopia.
use "$rep_data/Afro_eth.dta", clear

set more off
foreach var of varlist voted interested meeting_last_year raised_last_year protest_last_year ///
///
{
reg  `var' formal_work if female==1, robust 
 estadd local Sample "Women"
su `var' if e(sample)==1 & formal_work==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_fem
}

local varlist formal_work 
 
cd "$results"
#delimit;
	noisily esttab meeting_last_year_fem interested_fem raised_last_year_fem voted_fem protest_last_year_fem     using "Table_A18b.tex", 
	style(tex) stats(mean_depvar_c N r2 Sample, labels("Control mean" "N" "R-squared" "Sample")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community" "Interested" "Raised" "Voted" "Protest")
		keep(`varlist') order(`varlist')
		varlabels(
	formal_work "Has paid employment" 
	female "Female" 
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	

****************** Table A19 *******************************
* Afrobarometer all countries.
use "$rep_data/Afro_all.dta", clear

set more off
foreach var of varlist meeting_last_year interested raised_last_year voted protest_last_year formal_work ///
///
{
reg `var' female, robust
 estadd local Sample "All"
su `var' if e(sample)==1 & female==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_gap_all
}

local varlist female 
 
cd "$results"
#delimit;
	noisily esttab   meeting_last_year_gap_all interested_gap_all raised_last_year_gap_all voted_gap_all protest_last_year_gap_all formal_work_gap_all
	using "Table_A19.tex", 
	style(tex) stats(mean_depvar_c N r2 Sample, labels("Mean dep. for men" "N" "R-squared" "Sample")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community" "Interested" "Raised" "Voted" "Protest" "Paid Employment")
		keep(`varlist') order(`varlist')
		varlabels(
	formal_work "Has paid employment" 
	female "Female" 
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	

****************** Table A20 *******************************
* Afrobarometer ethiopia.
use "$rep_data/Afro_eth.dta", clear 

set more off
foreach var of varlist voted interested meeting_last_year raised_last_year protest_last_year formal_work ///
{
reg `var' female, robust
estadd local Sample "All"
su `var' if e(sample)==1 & female==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_gap
}

local varlist female
 
cd "$results"
#delimit;
	noisily esttab   meeting_last_year_gap interested_gap raised_last_year_gap  voted_gap protest_last_year_gap formal_work_gap
	using "Table_A20.tex", 
	style(tex) stats(mean_depvar_c N r2 Sample, labels("Mean dep. for men" "N" "R-squared" "Sample")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community" "Interested" "Raised" "Voted" "Protest" "Paid Employment")
		keep(`varlist') order(`varlist')
	varlabels(
	formal_work "Has paid employment" 
	female "Female" 
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
	

****************** Table A21 *******************************
* All waves
use "$rep_data/aw.dta", clear 

set more off
	foreach var of varlist meeting_last_year_r  interested_r raise_last_year_r attend_meet_Kebele_r ///
	///
	{
	areg `var' any_wage_job_last6_r if orig_treatment==0, cluster(N_Id) absorb(N_Id)
	 estadd local FE "Yes"
	 estadd local Wave "No"
	su `var' if e(sample)==1 & orig_treatment==0
	estadd scalar mean_depvar_c = r(mean)
	eststo `var'_fe_a
	areg `var' any_wage_job_last6_r i.wave if orig_treatment==0, cluster(N_Id) absorb(N_Id)
	 estadd local FE "Yes"
	 estadd local Wave "Yes"
	su `var' if e(sample)==1 & orig_treatment==0
	estadd scalar mean_depvar_c = r(mean)
	eststo `var'_fe_b
	
	}
	
local varlist any_wage_job_last6_r 
 
cd "$results"
#delimit;
	noisily esttab  meeting_last_year_r_fe_b attend_meet_Kebele_r_fe_b interested_r_fe_b 
	 raise_last_year_r_fe_b  
		using "controlgroup_fe_fu4.tex", 
	style(tex) stats(mean_depvar_c N r2 FE Wave, labels("Control mean" "N" "R-squared" "Individual FE" "Wave FE")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community"  "Kebele" "Interested" "Raise")
		keep(`varlist') order(`varlist')
	varlabels(
	any_wage_job_last6_r "Any wage job last 6 months" 
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr

	
****************** Table A22 *******************************
* WVS data
use "$rep_data/WVS_small.dta", clear 

* text:
reg interested  emp_other emp_unsk if female==1, robust
codebook S003 if e(sample)==1
tab emp_unsk
tab emp_unsk  if e(sample)==1

reg interested  employed if female==1, robust
 estadd local Sample "All"
su interested if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo interested_a
reg interested  emp_other emp_unsk if female==1, robust
 estadd local Sample "All"
su interested if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo interested_b
reg interested  emp_other emp_unsk if female==1 & continent=="Africa", robust
 estadd local Sample "Africa"
su interested if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo interested_c

reg petition  employed if female==1, robust
 estadd local Sample "All"
su petition if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo petition_a
reg petition  emp_other emp_unsk if female==1, robust
 estadd local Sample "All"
su petition if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo petition_b
reg petition  emp_other emp_unsk if female==1 & continent=="Africa", robust
 estadd local Sample "Africa"
su petition if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo petition_c

local varlist employed emp_unsk emp_other 
 
cd "$results"
#delimit;
	noisily esttab interested_a interested_b interested_c petition_a petition_b petition_c
		using "Table_A22.tex", 
	style(tex) stats(mean_depvar_c N r2 Sample, labels("Control mean" "N" "R-squared" "Sample")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Interested" "Interested" "Interested" "Petition" "Petition" "Petition")
		keep(`varlist') order(`varlist')
		varlabels(
	employed "Employed" 
	 emp_unsk  "Unskilled manual"
	 emp_other "Other employment"
				)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
****************** Table A23 *******************************
* WVS data
use "$rep_data/WVS_small.dta", clear 


reg interested  employed if female==0, robust
 estadd local Sample "All"
su interested if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo interested_a
reg interested  emp_other emp_unsk if female==0, robust
 estadd local Sample "All"
su interested if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo interested_b
reg interested  emp_other emp_unsk if female==0 & continent=="Africa", robust
 estadd local Sample "Africa"
su interested if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo interested_c

reg petition  employed if female==0, robust
 estadd local Sample "All"
su petition if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo petition_a
reg petition  emp_other emp_unsk if female==0, robust
 estadd local Sample "All"
su petition if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo petition_b
reg petition  emp_other emp_unsk if female==0 & continent=="Africa", robust
 estadd local Sample "Africa"
su petition if e(sample)==1 & employed==0
estadd scalar mean_depvar_c = r(mean)
eststo petition_c

local varlist employed emp_unsk emp_other 
 
cd "$results"
#delimit;
	noisily esttab interested_a   interested_b interested_c petition_a petition_b petition_c
		using "Table_A23.tex", 
	style(tex) stats(mean_depvar_c N r2 Sample, labels("Control mean" "N" "R-squared" "Sample")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Interested" "Interested" "Interested" "Petition" "Petition" "Petition")
		keep(`varlist') order(`varlist')
		varlabels(
	employed "Employed" 
	 emp_unsk  "Unskilled manual"
	 emp_other "Other employment"
				)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	

****************** Table A24 *******************************
* All waves
use "$rep_data/aw.dta", clear 

label var orig_treatment "Treatment status"
gen nf_job_last6_r=any_wage_job_last6_r
replace nf_job_last6_r=0 if fac_last6_r==1 
	
set more off
foreach var of varlist meeting_last_year_r  interested_r raise_last_year_r attend_meet_Kebele_r ///
///
{
areg `var' fac_last6_r nf_job_last6_r i.wave if orig_treatment==0, cluster(N_Id) absorb(N_Id)
 estadd local FE "Yes"
 estadd local Wave "Yes"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_fe_bu

}

local varlist fac_last6_r nf_job_last6_r 
 
cd "$results"
#delimit;
	noisily esttab  meeting_last_year_r_fe_bu attend_meet_Kebele_r_fe_bu interested_r_fe_bu 
	 raise_last_year_r_fe_bu  
		using "Table_A24.tex", 
	style(tex) stats(mean_depvar_c N r2 FE Wave, labels("Control mean" "N" "R-squared" "Individual FE" "Wave FE")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Community"  "Kebele" "Interested" "Raise")
		keep(`varlist') order(`varlist')
	varlabels(
	nf_job_last6_r "Any non-factory job last 6 months" 
	fac_last6_r "Any factory job last 6 months" 
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr

	


****************** Figure A11 *******************************
* Wave 2
use "$rep_data/w2.dta", clear 
 
rename (base_m_Idir_org  base_m_Other_religious base_m_Mahiber base_m_Onetofive_org base_m_Women_org base_m_Equb_org base_m_Development_org base_m_Microfinance_org base_m_Users_org base_m_Union_org   base_m_Customary_org base_m_Informal_org) (org#), addnumber(1)
gen n= _n
reshape long org, i(n)
label define _j 1 "Idir"  2 "Other Religious" 3 "Mahiber" 4 "Onefive" 5 "Women's association."   6 "Equb" 7 "Development" 8 "Microfinance"  9 "User org."   10 "Union"  11 "Customary" 12 "Informal"
label values _j _j

set scheme s1mono
graph bar org, over(_j, label(labsize(tiny))) asyvars showyvars legend(off) ytitle(Share of women that are members) 

graph export "$results/Figure_A11.png", replace	
graph export "$results/Figure_A11.pdf", replace
				
		

****************** Figure A12 *******************************
* Wave 2
use "$rep_data/w2.dta", clear 

su m_Idir_org  m_Other_religious m_Mahiber m_Onetofive_org m_Women_org  m_Equb_org m_Development_org m_Microfinance_org  m_Users_org  m_Union_org   m_Customary_org m_Informal_org

foreach var of varlist  m_Idir_org  m_Other_religious m_Mahiber m_Onetofive_org m_Women_org  m_Equb_org m_Development_org m_Microfinance_org  m_Users_org  m_Union_org   m_Customary_org m_Informal_org ///
///
{
gen diff_`var'= `var'-base_`var'
}
 
su diff_m_Idir_org  diff_m_Other_religious diff_m_Mahiber diff_m_Onetofive_org diff_m_Women_org  diff_m_Equb_org diff_m_Development_org diff_m_Microfinance_org  diff_m_Users_org  diff_m_Union_org   diff_m_Customary_org diff_m_Informal_org



rename (diff_m_Idir_org  diff_m_Other_religious diff_m_Mahiber diff_m_Onetofive_org diff_m_Women_org diff_m_Equb_org diff_m_Development_org diff_m_Microfinance_org diff_m_Users_org diff_m_Union_org   diff_m_Customary_org diff_m_Informal_org) (org#), addnumber(1)
gen n= _n
reshape long org, i(n)
label define _j 1 "Idir"  2 "Other Religious" 3 "Mahiber" 4 "Onefive" 5 "Women's association"   6 "Equb" 7 "Development" 8 "Microfinance"  9 "User org."   10 "Union"  11 "Customary" 12 "Informal"
label values _j _j

set scheme s1mono
graph bar org if orig_treatment==1, over(_j, label(labsize(tiny))) asyvars showyvars legend(off) ytitle(Difference w2-w1) title(Treated)
gr save a.gph, replace
graph bar org if orig_treatment==0, over(_j, label(labsize(tiny))) asyvars showyvars legend(off)  ytitle(Difference w2-w1)  title(Control)
gr save b.gph, replace
graph combine a.gph b.gph , rows(2)
graph export "$results/Figure_A12.png", replace	
graph export "$results/Figure_A12.pdf", replace
				
				
****************** Figure A13 *******************************
* Wave 2
use "$rep_data/w2.dta", clear 

gen nr_m_org=m_Mahiber+m_Other_religious+m_Women_org+m_Microfinance_org+m_Onetofive_org+m_Development_org+m_Idir_org+m_Equb_org+m_Union_org+m_Informal_org+m_Users_org+m_Customary_org
recode nr_m_org (1/12=1), gen(m_any_org)              
rename m_Idir_org Idir
rename m_Equb_org Equb
rename m_Mahiber Mahiber
rename m_Other_religious Other_religious
rename m_Onetofive_org Onetofive
rename m_Women_org Women
rename m_Development_org Development
rename m_Microfinance_org Microfinance
rename m_Users_org Users
rename m_Union_org Union
rename m_Customary_org Customary
rename m_Informal_org Informal



rename m_any_org Any_organization

foreach var of varlist Idir  Other_religious Mahiber Onetofive Women Equb Development Microfinance Users Union   Customary Informal Any_organization {
reg  `var'  orig_treatment  i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'
}

label var orig_treatment "Treatment"				
coefplot  Idir  Other_religious Mahiber Onetofive Women Equb Development Microfinance Users Union   Customary Informal Any_organization, keep(orig_treatment)    xline(0)  	labels
				graph export "$results/Figure_A13.png", replace	
				graph export "$results/Figure_A13.pdf", replace
				
		
		
		

****************** Table A25 *******************************
* Wave 5:
use "$rep_data/w5.dta", clear 

set more off
foreach var of varlist roads reduce_differences tax_houses tax_work  ///
///
{
reg  `var' orig_treatment  i.block, cl(N_Id) 
 estadd local Controls "Block"
su `var' if e(sample)==1 & orig_treatment==0
estadd scalar mean_depvar_c = r(mean)
eststo `var'_itt_a
}

local varlist orig_treatment 
 
cd "$results"
#delimit;
	noisily esttab roads_itt_a reduce_differences_itt_a tax_houses_itt_a tax_work_itt_a 
	using "Table_A25.tex", 
	style(tex) stats(mean_depvar_c N r2 Controls, labels("Control mean" "N" "R-squared" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(a2) se 
mtitles("Roads" "Reduce differences"  "Tax houses" "Tax work")
		keep(`varlist') order(`varlist')
		varlabels(
	orig_treatment "Treatment"
		)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
	










	